using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class ItemDet_HistoryMap : EntityTypeConfiguration<ItemDet_History>
    {
        public ItemDet_HistoryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ItemDet_History_ITEM, t.ItemDet_History_LOCATION, t.ItemDet_History_EXPIRYDATE });

            // Properties
            this.Property(t => t.ItemDet_History_ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.ItemDet_History_LOCATION)
                .IsRequired()
                .HasMaxLength(3);

            // Table & Column Mappings
            this.ToTable("ItemDet_History");
            this.Property(t => t.ItemDet_History_ITEM).HasColumnName("ItemDet_History_ITEM");
            this.Property(t => t.ItemDet_History_LOCATION).HasColumnName("ItemDet_History_LOCATION");
            this.Property(t => t.ItemDet_History_EXPIRYDATE).HasColumnName("ItemDet_History_EXPIRYDATE");
            this.Property(t => t.ItemDet_History_Cost).HasColumnName("ItemDet_History_Cost");
            this.Property(t => t.ItemDet_History_Quantity).HasColumnName("ItemDet_History_Quantity");
            this.Property(t => t.ItemDet_History_PhysicalDate).HasColumnName("ItemDet_History_PhysicalDate");
        }
    }
}
